package com.msb.tank;

import java.io.IOException;
import java.util.Optional;
import java.util.Properties;

public class PropertyMgr {
    private static final Properties properties = new Properties();

    static {
        try {
            properties.load(PropertyMgr.class.getClassLoader().getResourceAsStream("config.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static Object get(String key) {
        return Optional.ofNullable(key).map(properties::get).orElse(null);
    }

    public static void main(String[] args) {
        System.out.println(PropertyMgr.get("tankInitCount"));
    }
}
